#!/bin/bash
#
# For NVIDIA Jetson Module Camera test
#

# Camera device node
CAM_NODE=/dev/video$1

########################################################

function usage()
{
	echo -e "Usage: ./$(basename $0) <cam>\n"
	echo -e "  cam can be 0, 1"
	echo -e "  eg: ./$(basename $0) 0\n"
}

########################################################

if [[ $# -lt 1 ]]; then
	usage
	exit 1
fi

if [[ ! ${CAM_NODE} =~ ^/dev/video[0-1]$ ]]; then
	usage
	exit 1
fi

#export DISPLAY=:0

gst-launch-1.0 \
    v4l2src device=${CAM_NODE} \
    ! videoconvert \
    ! ximagesink
